package com.kaifamiao.pojo;

import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

public class User {
    private int userId;
    @NotBlank(message = "请输入手机号")
    @Pattern(regexp ="\\d{11}",message = "请输入11位的手机号码")
    private String phoneNumber;
    @NotBlank(message = "请输入密码")
    @Size(min = 6,max = 16,message = "请输入6-16位的密码")
    @Pattern(regexp = "(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}",message = "请输入字母和数字组合的密码")
    private String userPass;
    //为了在后端验证数据，在数据库不存在
    @NotBlank(message = "请确认密码")
    private String reUserPass;
    @NotBlank(message = "请输入真实姓名")
    @Pattern(regexp = "([\\u4e00-\\u9fa5]{1,20}|[a-zA-Z\\.\\s]{1,20})",message = "请输入您的真实姓名")
    private String realName;
    @NotBlank(message = "请输入身份证号")
    @Pattern(regexp = "(\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x))",message = "请输入正确格式的身份证号")
    private String idNumber;

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getUserPass() {
        return userPass;
    }

    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }

    public String getReUserPass() {
        return reUserPass;
    }

    public void setReUserPass(String reUserPass) {
        this.reUserPass = reUserPass;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", phoneNumber='" + phoneNumber + '\'' +
                ", userPass='" + userPass + '\'' +
                ", reUserPass='" + reUserPass + '\'' +
                ", realName='" + realName + '\'' +
                ", idNumber='" + idNumber + '\'' +
                '}';
    }
}
